package cc.magicjson.example.demo.web.controller;

import cc.magicjson.example.demo.domain.UserInfo;
import cc.magicjson.example.demo.threadlocal.context.UserContext;
import cc.magicjson.example.demo.web.respository.UserRepository;
import cc.magicjson.example.demo.web.service.UserService;
import org.apache.catalina.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * {@link}
 *
 * @author <a href="mailto:it_magicjson@163.com">MagicJson</a>
 * @since 1.0.0
 */
@RestController
public class UserController {

	@Autowired
	private UserService userService;

	@Autowired
	private UserRepository userRepository;

	@GetMapping("/userinfo")
	public void getUserInfo() {

		System.out.printf("current thread:[%s], main-thread:%s\n"
				,Thread.currentThread().getName()
				, UserContext.getUserInfo());

		userService.ayncGetUserInfo();

	}




}
